<?php

namespace app\notify\controller;

use app\BaseController;

class AliNotify extends BaseController
{
    /**
     * 支付宝异步回调
     * @created 2019/9/12 17:11
     */
    public function alipay() {
        //注意旧版是Web,新版是Aop
        $alipay = addons_action('Alipay', 'Aop', 'init');
        try {
            $arr = $alipay->verifyNotify();
            $verifyService = new \app\service\order\Verify();
            $verifyService->verify($arr['out_trade_no'], 'alipay', $arr, $arr['trade_no'], $arr['total_amount']);
        } catch (\Exception $e) {
            \think\facade\Log::error($e->getMessage());
            $alipay->NotifyProcess(false, $e->getMessage());
        }
        $alipay->NotifyProcess(true);
    }
}